﻿
using CommonTools;


using Sunny.UI;
using System;
using System.Windows.Forms;

namespace StationDemo
{
    public partial class Form_Set : UIPage
    {
        public Form_Set()
        {
            InitializeComponent();
            //电机界面
            Form_AxisTestSunny form_AxisTest = new Form_AxisTestSunny();
            form_AxisTest.TopLevel = false;
            form_AxisTest.Dock = DockStyle.Fill;
            tabMotion.Controls.Add(form_AxisTest);
            form_AxisTest.Show();

            //IO界面
            Form_IO form_IO = new Form_IO();
            form_IO.TopLevel = false;
            form_IO.Dock = DockStyle.Fill;
            tabIO.Controls.Add(form_IO);
            form_IO.Show();

            //工站
            string strStationName = "";
            foreach (var st in StationMgr.GetInstance().GetDicStaion())
            {
                Form temp = (Form)st.Key;
                temp.Name = st.Value.Name;
                strStationName = st.Value.Name;
                temp.TopLevel = false;
                temp.Dock = DockStyle.Fill;
                temp.Show();

                TabPage tab = new TabPage();
                tab.Name = strStationName;
                tab.Text = strStationName;
                tab.Controls.Add(temp);
                tabMenu.TabPages.Add(tab);
                temp.Name = strStationName;
            }
            int stationIndexStart = 3;
            if (tabMenu.TabPages.Count > 3)
                stationIndexStart = 3;
            else
                stationIndexStart = 0;
            tabMenu.SelectedIndex = stationIndexStart;
            tabMenu.TabPages[stationIndexStart].Controls[0].Show();

        }

        private void Form_Set_Load(object sender, EventArgs e)
        {


        }
    }
}
